package queries;

import java.sql.Connection;
import java.sql.Date;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;

import entitys.LoginUser;
import enums.Result;

public class SetLastAddressedQuery {

	public static Result exe(Integer integer, Connection conn) {
		Statement stmt;
		DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
		Calendar date = Calendar.getInstance();
		try {
			stmt = conn.createStatement();
			java.util.Date d = new java.util.Date();
			stmt.executeUpdate("UPDATE `ccrm`.`customer` SET `lastAddressed`='"+dateFormat.format(date.getTime())+"' WHERE `id`='"+integer.intValue()+"';");
			return Result.OK;
		
		} catch (SQLException e) {	return Result.ERROR;}
		
	}

}
